package com.borya.action.server;

import com.alibaba.fastjson.JSONObject;
import com.borya.action.BaseAction;
import com.borya.framework.annotation.Action;
import com.borya.framework.annotation.Autowired;
import com.borya.framework.annotation.JsonResult;
import com.borya.framework.annotation.UrlMapping;
import com.borya.framework.core.ServerRequest;
import com.borya.framework.core.ServerResponse;
import com.borya.service.server.UserService;
import org.apache.log4j.Logger;

@UrlMapping("/s/user/")
@Action
public class UserAction extends BaseAction{

	private Logger log = Logger.getLogger(getClass());
	@Autowired("server_userServiceImpl")
	private UserService userService;
	
	@UrlMapping("getSmsCode")
	@JsonResult
	public String getSmsCode(ServerRequest request,ServerResponse response) {
		JSONObject json = getJson(request);
		String result = userService.getSmsCode(json);
		log.info("INFO[" + json + "],OUT[" + result + "]");
		return result;
	}
	
	
	@UrlMapping("registAudited")
	@JsonResult
	public String registAudited(ServerRequest request,ServerResponse response) {
		JSONObject json = getJson(request);
		String result = userService.registAudited(json);
		log.info("INFO[" + json + "],OUT[" + result + "]");
		return result;
	}


	@UrlMapping("shqpInfo")
	@JsonResult
	public String shqpInfo(ServerRequest request,ServerResponse response) {
		JSONObject json = getJson(request);
		String result = userService.getShqpInfo(json);
		log.info("INFO[" + json + "],OUT[" + result + "]");
		return result;
	}

	/**
	 * 秦波新加，更改门店使用地区、用户使用人信息专用内部接口
	 * @param request
	 * @param response
	 * @return
	 */
	@UrlMapping("userClientAndRegion")
	@JsonResult
	public String userClientAndRegion(ServerRequest request, ServerResponse response) {
		String result = userService.userClientAndRegion();
		log.info("OUT[" + result + "]");
		return result;
	}

    /**
     * 添加子工号审核完成回调接口
     *
     * @param request
     * @param response
     * @return
     */
    @UrlMapping("addJobNumAuditBack")
    @JsonResult
    public String addJobNumAuditBack(ServerRequest request, ServerResponse response) {
        JSONObject json = getJson(request);
        String result = userService.addJobNumAuditBack(json);
        log.info("INFO[" + json + "],OUT[" + result + "]");
        return result;
    }
}